{ "cells": [ { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true, "nbsphinx": "hidden" }, "outputs": [], "source": [ "%matplotlib inline\n", "import warnings\n", "warnings.filterwarnings('ignore')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Trends with the SAGE II / OSIRIS / OMPS-LP Dataset\n", "\n", "Here we calculate trends using the SAGE II / OSIRIS / OMPS-LP dataset by regressing to deseasonalized relative monthly zonal mean anomalies" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "import xarray as xr\n", "import numpy as np\n", "from LOTUS_regression.regression import regress_all_bins\n", "from LOTUS_regression.predictors import load_data" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The data is in a single NetCDF4 file." ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "MERGED_FILE = r'/media/users/data/LOTUS/S2_OS_OMPS/MERGED_LOTUS.nc'\n", "\n", "mzm_data = xr.open_dataset(MERGED_FILE, engine='netcdf4')\n", "\n", "print(mzm_data)" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "predictors = load_data('pred_baseline_pwlt.csv')\n", "\n", "print(predictors.columns)" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "results = regress_all_bins(predictors, mzm_data['relative_anomaly'], tolerance=0.1)\n", "\n", "# Convert to ~ percent\n", "results *= 100\n", "\n", "print(results)" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "import LOTUS_regression.plotting.trends as trends\n", "trends.pre_post_with_confidence(results, x='mean_latitude', y='altitude', ylim=(18, 50), log_y=False, figsize=(16, 6),\n", " x_label='Latitude [$^\\circ$]', y_label='Altitude [km]', pre_title='Pre 1997',\n", " post_title='Post 1997')" ] } ], "metadata": { "celltoolbar": "Edit Metadata", "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.6.1" } }, "nbformat": 4, "nbformat_minor": 2 }